import numpy as np
import matplotlib.pyplot as plt


def square_func(x, a, b, c):
    return x ** 2 * a + x * b + c


def cubic_func(x, a, b, c, d):
    return x ** 3 * a + x ** 2 * b + x * c + d


def quad_func(x, a, b, c, d, e):
    return x ** 4 * a + x ** 3 * b + x ** 2 * c + x * d + e


def get_square_data(min, max, size, abc, delta):
    a, b, c = abc
    x = np.linspace(min, max, size)
    y = square_func(x, a, b, c)
    delta_vector = np.random.uniform(-delta, delta, size)
    x += delta_vector
    delta_vector2 = np.random.uniform(-delta, delta, size)
    y += delta_vector2
    return x, y


if '__main__' == __name__:
    a, b, c = 0.05, -20, -10000
    m = 20
    delta = 200
    x, y = get_square_data(-100, 1200, m, [a, b, c], delta)
    plt.scatter(x, y, s=1)
    plt.grid()
    plt.show()
